/*********************************************************************
Replication Materials for "Explanation Giving Promotes Democratic Satisfaction Regardless of Respondent Partisanship"

Syntax produces the models discussed in Online Appendix D.
***********************************************************************/

/*******************
Working Directory and Data
Update working directory to where you have the data
********************/

cd "C:\Users\jar68\OneDrive\Ongoing Work\Explanations and Dem Support\P. Behavior\Revision\R2\RR3\FINAL\Dataverse\"
use "ess_final.dta"

**Dropping non-democracies; Bulgaria had caretaker gov't
drop if country == "Albania" | country == "Russia" | country == "Kosovo" | country == "Ukraine" | country == "Bulgaria"

/*********************************
Weights
*********************************/

gen anweight = pspwght*pweight
label var anweight "Analysis Weight"



/*********************************
Models
*********************************/

eststo clear
local conts " std_courts std_elections std_econ std_life std_socialtrust i.ideol_ext1 std_ladder std_educ c.age i.gender i.minority i.citizen i.east_europe c.enep_comb c.unemp_ch"
foreach var in gov_satis dem_satis {
	eststo: mixed `var' std_explains reason_std i.co_partisan `conts'  [pweight=anweight] || country: 
	eststo: mixed `var' std_explains reason_std i.co_partisan `conts' i.bailout [pweight=anweight] || country: 
	eststo: mixed `var' c.std_explains##i.co_partisan c.reason_std##i.co_partisan `conts' [pweight=anweight] || country: 
	eststo: mixed `var' c.std_explains##i.co_partisan c.reason_std##i.co_partisan `conts' i.bailout [pweight=anweight] || country: 
}


***Full Table
esttab using table_od1.rtf, label onecell replace se b(3) aic bic nobaselevels ///
		transform(ln*: exp(2*@) 2*exp(2*@)) ///
		eqlabels("" "var(Constant)" "var(Residual)", none) ///
		mtitles("Gov" "Gov" "Gov" "Gov" "Dem" "Dem" "Dem" "Dem") ///
		title("{\b Table OD1}: Explanation Giving and Political Support (Control for Bailout Countries)") ///
		addnotes("DV ranges from 0-10. All continuous variables are country-standardized save for age in years. Analyses use survey weights.")

